<Window
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" d:DesignHeight="304" d:DesignWidth="438" SizeToContent="WidthAndHeight" Title="SizeDemo">
  <Canvas>
    <TextBox Canvas.Top="20" Canvas.Left="20">no explicit size, auto-sized to fit content</TextBox>
    <TextBox Canvas.Top="60" Canvas.Left="20" Width="auto" Height="auto">if not set, it is equal to be set as 'auto'</TextBox>
    <TextBox Canvas.Top="100" Canvas.Left="20" Height="50" Width="300">explict size, enough space</TextBox>
    <TextBox Canvas.Top="160" Canvas.Left="20" Height="10" Width="200">explict size, shrink due to insufficient space</TextBox>
        <TextBox Canvas.Top="200" Canvas.Left="20" Height="50" Width="300" Padding="10,15">explict size with padding</TextBox>
  </Canvas>
</Window>